-
Notifications
You must be signed in to change notification settings - Fork 655
nxboot: enhance the access to flash device #3136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There is no need to use buffers in a bootloader. We expect a sequential access, therefore we just need to erase the erase page before writing to it for the first time, which is something FTL layer already takes care of. Signed-off-by: Michal Lenc <[email protected]>
The previous logic MAX(info_from.blocksize, info_where.blocksize) was incorrect. The most effective access with by writing the entire size of the block, therefore just decide the size based on the target page size. Signed-off-by: Michal Lenc <[email protected]>
@TimJTi adding this as a draft now, could you test it with your environment when you have time? Thanks! |
@michallenc Of course - probably not until next week though: hope that's OK. |
Absolutely, this is just a quiality of life change, no need for a quick merge. |
@TimJTi Hi, did you find time to test the patch? Thanks. |
Today's task (one of). Sorry for the delay ! |
@michallenc @xiaoxiang781216 And it seems very much faster too, unless it's my imagination!? PS: I found an error in my recently added progress percentage display for NXBoot, and will shortly submit a small PR for that. |
Thanks! Yes, it should in theory be faster with the direct access, we avoid some unnecessary buffering and erases. |
Excellent 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @michallenc great work! Also thank you @TimJTi for verification! :-)
Summary
619ea01 boot/nxboot/loader/flash.c: open partition with O_DIRECT flag
There is no need to use buffers in a bootloader. We expect a sequential
access, therefore we just need to erase the erase page before writing
to it for the first time, which is something FTL layer already takes
care of.
95e4b0c boot/nxboot/loader/boot.c: copy partition with blocksize large writes
The previous logic
MAX(info_from.blocksize, info_where.blocksize)
wasincorrect. The most effective access with by writing the entire
size of the block, therefore just decide the size based on the
target page size.
Impact
Nxboot now utilizes changes presented in apache/nuttx#16642. Should not have impact on current implementation as the additional flags are ignored if changes in apache/nuttx#16642 are not applied.
Testing
Tested with apache/nuttx#16642 patch applied. Nxboot successfully updates and reverts new image. All works as before, but additional buffering is skipped.